import java.util.Scanner;

public class test {
    private static int count = 0;//计数器

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        hanoi(n,'A','B','C');
        System.out.println(count+"次");
    }
    public static void hanoi(int n,char from,char aux,char to){
        if(n == 1){
            count++;
            System.out.println(count+":"+from+"-->"+to);
        }else{
            hanoi(n-1,from,to,aux);
            count++;
            System.out.println(count+":"+from+"-->"+to);
            hanoi(n-1,aux,from,to);
        }
    }
}
